/// @tags:
#include <cmath>
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

int const N = 1e2 + 5, mod = 1e9 + 7, shf = 51;

int n, R, p1, p2, p3, p4;
int lim[N], a[N][N], k[N][N][N], C[N][N];

inline LL qpow(LL base, int exp) {
  LL res = 1;
  while (exp) {
    if (exp & 1) res = res * base % mod;
    base = base * base % mod;
    exp >>= 1;
  }
  return res;
}

inline void solve(int n) {
  for (int i = 1; i <= n; ++i) {
    if (a[i][i] == 0)
      for (int j = i + 1; j <= n; ++j)
        if (a[j][i]) {
          swap(a[i], a[j]);
          break;
        }
    LL inv = qpow(a[i][i], mod - 2);
    for (int j = i; j <= n + 1; ++j) a[i][j] = inv * a[i][j] % mod;
    for (int j = i + 1, t = a[j][i]; j <= n; ++j, t = a[j][i])
      for (int k = i; k <= n + 1; ++k)
        if ((a[j][k] -= (LL)a[i][k] * t % mod) < 0) a[j][k] += mod;
  }
  for (int i = n; i > 1; --i)
    for (int j = 1; j < i; ++j)
      if ((a[j][n + 1] -= (LL)a[i][n + 1] * a[j][i] % mod) < 0) a[j][n + 1] += mod;
}

inline int main() {
  cin >> R >> p1 >> p2 >> p3 >> p4;
  LL inv = qpow(p1 + p2 + p3 + p4, mod - 2);
  p1 = p1 * inv % mod, p2 = p2 * inv % mod, p3 = p3 * inv % mod, p4 = p4 * inv % mod;
  for (int i = -R; i <= R; ++i) {
    lim[i + shf] = int(sqrt(R * R - i * i) + 1);
    k[shf - lim[i + shf] + 1][i + shf][i + R] = 1;
  }
  inv = qpow(p3, mod - 2);
  for (int i = -R + 1; i <= R + 1; ++i) {
    for (int j = -R; j <= R; ++j) {
      if (i > -lim[j + shf] + 1 && i <= lim[j + shf]) {
        for (int l = 0; l <= 2 * R; ++l) {
          if ((k[i + shf][j + shf][l] = (k[i - 1 + shf][j + shf][l] -
                                         (LL)p1 * k[i - 2 + shf][j + shf][l] % mod -
                                         (LL)p2 * k[i - 1 + shf][j - 1 + shf][l] % mod -
                                         (LL)p4 * k[i - 1 + shf][j + 1 + shf][l] % mod) %
                                        mod) < 0)
            k[i + shf][j + shf][l] += mod;
          k[i + shf][j + shf][l] = inv * k[i + shf][j + shf][l] % mod;
        }
        C[i + shf][j + shf] =
            ((C[i - 1 + shf][j + shf] - (LL)p1 * C[i - 2 + shf][j + shf] % mod -
              (LL)p2 * C[i - 1 + shf][j - 1 + shf] % mod -
              (LL)p4 * C[i - 1 + shf][j + 1 + shf] % mod - 1) %
                 mod +
             mod) *
            inv % mod;
      }
    }
  }
  for (int i = -R; i <= R; ++i) {
    for (int l = 0; l <= 2 * R; ++l)
      a[i + R + 1][l + 1] = k[shf + lim[i + shf]][i + shf][l];
    a[i + R + 1][2 * R + 2] = mod - C[shf + lim[i + shf]][i + shf];
  }
  solve(2 * R + 1);
  int ans = 0;
  for (int l = 0; l <= 2 * R; ++l)
    if ((ans += (LL)k[shf][shf][l] * a[l + 1][2 * R + 2] % mod) >= mod) ans -= mod;
  if ((ans += C[shf][shf]) >= mod) ans -= mod;
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("CF963E Circles of Waiting.in", "r", stdin);
  freopen("CF963E Circles of Waiting.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
